{{template "template/Base.html" .}}
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>{{.Title}}</title>
    {{template "head" .Respond}}
    {{.HtmlHead}}
  </head>
  <body>
    <div class="container">
        <nav class="navbar navbar-default" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                </button>
                <a class="navbar-brand" href="#">网站管理</a>
            </div>
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    {{range .MenuList}}
                        <li {{if eq $.Menuid .Id}} class="active" {{end}}>
                            <a
                            {{if eq .Name ""}} href="#"
                            {{else}} href='{{urlfor .Name}}'
                            {{end}}>{{.Title}}</a>
                        </li>
                    {{end}}
                </ul>
                {{if .showsearch}}
                <form class="navbar-form navbar-left" id="searchfrom" role="search" method="get" action='{{.SearchUrl}}'>
                    <div class="form-group">
                        <input type="text" name="keyword"  class="form-control" value="{{.search}}" placeholder="Search">
                        <input type="hidden" name="sort" id="search_sort" value="{{.sort}}">
                    </div>
                    <button type="submit" class="btn btn-default">
                        <span class="glyphicon glyphicon-search"></span>
                    </button>
                </form>
                {{end}}
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <span class="visible-sm visible-xs">
                                用户管理<span class="fui-user"></span>
                            </span>
                            <span class="visible-md visible-lg">
                                <span class="fui-user"></span> {{.username}}
                            </span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="#">修改密码</a></li>
                            <li><a href="#">个人信息</a></li>
                            <li><a href='{{urlfor "RootController.Index"}}'>返回主页</a></li>
                            <li class="divider"></li>
                            <li><a href='{{urlfor "RootController.LoginOut"}}'>注销</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
        <div class="row">
            <div class="col-md-2">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        {{range .MenuList}}
                            {{if eq $.Menuid .Id}}
                                {{.Title}}
                            {{end}}
                        {{end}}
                    </div>
                    <ul class="list-group">
                        {{range .Submenu}}
                            <li class="list-group-item {{if eq $.Subid .Id}} active {{end}} ">
                                <a
                                {{if eq .Name ""}} href="#"
                                {{else}} href='{{urlfor .Name}}'
                                {{end}}>{{.Title}}</a>
                            </li>
                        {{end}}
                    </ul>
                </div>
            </div>
            <div class="col-md-10">
                <ol class="breadcrumb">
                    <li>
                        {{range .MenuList}}
                            {{if eq $.Menuid .Id}}
                                <a {{if eq .Name ""}} href="#"
                                {{else}} href='{{urlfor .Name}}'
                                {{end}}>{{.Title}}</a>
                            {{end}}
                        {{end}}
                    </li>
                    <li>
                        {{range .Submenu}}
                            {{if eq $.Subid .Id}}
                                <a {{if eq .Name ""}} href="#"
                                {{else}} href='{{urlfor .Name}}'
                                {{end}}>{{.Title}}</a>
                            {{end}}
                        {{end}}
                    </li>
                </ol>
                {{.LayoutContent}}
            </div>
        </div>
    </div>
    <div>
        {{.SideBar}}
    </div>
    <form class="hide" action="" id="from_post"  method="post"></form>
    <!-- /.container -->
    {{template "basejs"}}
    <style type="text/css">
        .dropdown-menu {
            min-width: auto;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            Messenger.options = { extraClasses: "messenger-fixed messenger-on-top", theme: "flat" };
            {{if .flash.success}}
                Messenger().post({message: "{{.flash.success}}",type: 'success'});
            {{end}} 
            {{if .flash.notice}}
                Messenger().post({message: "{{.flash.notice}}",type: 'success'});
            {{end}} 
            {{if .flash.warning}}
                Messenger().post({message: "{{.flash.warning}}",type: 'info'});
            {{end}} 
            {{if .flash.error}}
                Messenger().post({message: "{{.flash.error}}",type: 'error'});
            {{end}}
			$(".a_post").on("click",function(event){
				event.preventDefault();
                $('#from_post').attr("action",$(this).attr("href"));
                $('#from_post').submit();
			});
        })
    </script>
    {{.Scripts}}
  </body>
</html>